# .新建“exerc2”Python文件完成作业：已知照片的URL地址为：
# http://n.sinaimg.cn/news/crawl/117/w550h367/20220417/a3a9-08b2ca6dffe4210149dda424adf0734f.jpg，请将照片下载并保存在桌面上。
from urllib.request import urlopen

def get(url1):
    resp = urlopen(url1)
    data = resp.read()
    return data
def clone(data, url2):
    with open(url2, 'wb') as f:
        f.write(data)
        print('over!')


if __name__ == '__main__':
    clone(get('http://n.sinaimg.cn/news/crawl/117/w550h367/20220417/a3a9-08b2ca6dffe4210149dda424adf0734f.jpg'),
          'C:\\Users\\Administrator\\Desktop\\1.jpg')
